//
//  SquareMapTableview.m
//  Zuker
//
//  Created by MB__Lee on 2018/5/20.
//  Copyright © 2018年 zuke.com. All rights reserved.
//

#import "SquareMapTableview.h"

#define  Cell_hight 50

@interface SquareMapTableview()


@end
static NSString *BaseTypeCell_Identi = @"BaseTypeCell";
@implementation SquareMapTableview

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BaseTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:BaseTypeCell_Identi];
    
    if (self.sourceMut.count) {
         cell.model = self.sourceMut[indexPath.row];
    }
   
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return  cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    

    if ([self.BaseDelegate respondsToSelector:@selector(BaseTypeTableVeiw:sendModel:)]) {
        
        BaseModel *model = self.sourceMut[indexPath.row];
        [self.BaseDelegate BaseTypeTableVeiw:self sendModel:model];
    }
}
-(void)setSourceMut:(NSMutableArray *)sourceMut{
    
    [super setSourceMut:sourceMut];
    
    CGRect frame = self.frame;
    CGFloat cacultaHeight = (sourceMut.count) * Cell_hight;
    if (cacultaHeight > 0.7 *SCREEN_HIGHT) {
        frame.size.height = 0.7 * SCREEN_HIGHT;
    }else{
        frame.size.height = cacultaHeight;
    }
    
    
    self.frame = frame;
    
}

@end
